package com.example.elderlycare.service;

import com.example.elderlycare.dao.entity.SmsLog;
import com.example.elderlycare.exception.AuthCodeExpiredException;
import com.example.elderlycare.exception.AuthCodeNotMatchException;
import com.example.elderlycare.exception.NoBalanceException;
import com.example.elderlycare.service.entity.SmsResponseBody;

public interface SmsService {
    /**
     * 发送验证码
     *
     * @param phoneNumber 电话号码
     * @param authCode    验证码
     * @return SmsResponseBody
     * @throws NoBalanceException 余额不足
     */
    SmsResponseBody sendAuthCode(String phoneNumber, String authCode) throws NoBalanceException;

    /**
     * 验证验证码
     *
     * @param uuid     发送验证码所返回的 uuid
     * @param authCode 验证码
     * @return boolean
     * @throws AuthCodeExpiredException  验证码过期
     * @throws AuthCodeNotMatchException 验证码错误
     */
    boolean verifyAuthCode(String uuid, String authCode) throws AuthCodeExpiredException,
            AuthCodeNotMatchException;

    /**
     * 根据uuid获取对应的信息发送记录
     *
     * @param uuid 信息发送记录表主键
     * @return SmsLog
     */
    SmsLog getSmsLogByUuid(String uuid);
}
